home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #5 & #6
/
Amiga Plus CD - 1995 - No. 5 and 6.iso
/
pd
/
netz
/
term
/
extras
/
source
/
term-source.lha
/
UploadPanel.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-07
|
4KB
|
212 lines
/*
** UploadPanel.c
**
** ZModem auto-upload control panel support routines
**
** Copyright © 1990-1995 by Olaf `Olsen' Barthel
** All Rights Reserved
*/
#include "termGlobal.h"
BYTE __regargs
UploadPanel(BOOLEAN SendMode)
{
struct LayoutHandle *Handle;
BYTE Selection = UPLOAD_IGNORE,
FromQueue;
if(SendMode)
FromQueue = CheckUpload();
else
FromQueue = FALSE;
if(Handle = LT_CreateHandleTags(Window -> WScreen,
LH_LocaleHook, &LocaleHook,
TAG_DONE))
{
struct Window *PanelWindow;
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
LA_LabelID, MSG_UPLOADPANEL_SELECT_TRANSFER_TYPE_GAD,
TAG_DONE);
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, SendMode ? MSG_UPLOADPANEL_TEXT_UPLOAD_GAD : MSG_UPLOADPANEL_TEXT_DOWNLOAD_GAD,
LA_ID, UPLOAD_TEXT,
TAG_DONE);
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, SendMode ? MSG_UPLOADPANEL_BINARY_UPLOAD_GAD : MSG_UPLOADPANEL_BINARY_DOWNLOAD_GAD,
LA_ID, UPLOAD_BINARY,
LABT_ReturnKey, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
if(SendMode)
{
LT_New(Handle,
LA_Type,VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, CHECKBOX_KIND,
LA_LabelID, MSG_UPLOADPANEL_FROM_UPLOAD_QUEUE_TXT,
LA_BYTE, &FromQueue,
LABT_ReturnKey, TRUE,
LA_ID, UPLOAD_DUMMY,
TAG_DONE);
LT_New(Handle,
LA_Type, XBAR_KIND,
LAXB_FullSize, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
}
LT_New(Handle,LA_Type,HORIZONTAL_KIND,
LAGR_SameSize, TRUE,
LAGR_Spread, TRUE,
TAG_DONE);
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_UPLOADPANEL_IGNORE_GAD,
LA_ID, UPLOAD_IGNORE,
LABT_ExtraFat, TRUE,
TAG_DONE);
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_ABORT_GAD,
LA_ID, UPLOAD_ABORT,
LABT_EscKey, TRUE,
LABT_ExtraFat, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
if(PanelWindow = LT_Build(Handle,
LAWN_TitleID, MSG_UPLOADPANEL_TRANSFER_TYPE_TXT,
LAWN_IDCMP, IDCMP_CLOSEWINDOW,
LAWN_HelpHook, &GuideHook,
LAWN_Parent, Window,
WA_DepthGadget, TRUE,
WA_CloseGadget, TRUE,
WA_DragBar, TRUE,
WA_RMBTrap, TRUE,
WA_Activate, TRUE,
TAG_DONE))
{
struct IntuiMessage *Message;
BOOLEAN Done = FALSE;
ULONG MsgClass,
MsgQualifier;
UWORD MsgCode;
struct Gadget *MsgGadget;
GuideContext(CONTEXT_TRANSFER);
PushWindow(PanelWindow);
LT_ShowWindow(Handle,TRUE);
do
{
if(Wait(PORTMASK(PanelWindow -> UserPort) | SIG_BREAK) & SIG_BREAK)
{
Selection = UPLOAD_ABORT;
break;
}
while(Message = (struct IntuiMessage *)GT_GetIMsg(PanelWindow -> UserPort))
{
MsgClass = Message -> Class;
MsgQualifier = Message -> Qualifier;
MsgCode = Message -> Code;
MsgGadget = (struct Gadget *)Message -> IAddress;
GT_ReplyIMsg(Message);
LT_HandleInput(Handle,MsgQualifier,&MsgClass,&MsgCode,&MsgGadget);
if(MsgClass == IDCMP_CLOSEWINDOW)
{
Selection = UPLOAD_ABORT;
Done = TRUE;
}
if(MsgClass == IDCMP_GADGETUP)
{
switch(MsgGadget -> GadgetID)
{
case UPLOAD_TEXT:
if(FromQueue && !CheckUpload())
FromQueue = FALSE;
if(FromQueue)
Selection = UPLOAD_TEXT_FROM_LIST;
else
Selection = UPLOAD_TEXT;
Done = TRUE;
break;
case UPLOAD_BINARY:
if(FromQueue && !CheckUpload())
FromQueue = FALSE;
if(FromQueue)
Selection = UPLOAD_BINARY_FROM_LIST;
else
Selection = UPLOAD_BINARY;
Done = TRUE;
break;
default:
if(MsgGadget -> GadgetID != UPLOAD_DUMMY)
{
Selection = MsgGadget -> GadgetID;
Done = TRUE;
}
break;
}
}
}
}
while(!Done);
PopWindow();
}
LT_DeleteHandle(Handle);
}
return(Selection);
}